package com.inhgroup.flashcards.data;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
 * Tests the TestCard class.
 * 
 * @author Branden Ogata
 *
 */

public class TestCard
{
  /** 
   * Tests the methods in the Card class.
   * 
   */
  
  @Test
  public void test()
  {
    Card front = new Card("front", "前");
    Card back = new Card("back", "後ろ");
    Card frontCopy = new Card("front", "前");
    
    assertEquals("Front of card set correctly", "front", front.getFront());
    assertEquals("Back of card set correctly", "後ろ", back.getBack());
    assertEquals("Front and left should be same", front.getFront(), front.getLeft());
    assertEquals("Back and right should be same", back.getBack(), back.getRight());
    
    assertTrue("Front should equal itself", front.equals(front));
    assertTrue("Front should equal its copy", front.equals(frontCopy));
    assertTrue("Front should equal its copy--commutable", frontCopy.equals(front));
    assertFalse("Front should not equal back", front.equals(back));
    assertFalse("Front should not equal back--commutable", back.equals(front));
    
    assertEquals("Front hashcode should equal own hashcode", front.hashCode(), front.hashCode());
    assertEquals("Front hashcode should equal copy hashcode", front.hashCode(), 
                                                              frontCopy.hashCode());
  }

}
